A unique submission to our code kata challenge has won himself 2nd place and a copy of Are You Smart Enough to Work at Google?. So let’s review the Challenge, announce the winner, and check out his code:
- Implement a queue class using 2 stacks internally
- The queue class should implement an insert and retrieve method
- The 2 internal stacks should implement push and pop methods
And the 2nd place winner is? Andy! A good friend of BTI360.
Andy’s implementation gets extra points for a couple unique attributes:
- Front-end language – Written in JavaScript and leveraged AngularJS.
- JSFiddle – Posted on JSFiddle and to make it easily testable in the browser.
- Efficient design – More efficient than passing each element back and forth between stacks before retrieval.
The implementation also inspired the judge to take a few lessons in AngularJS, at angular.codeschool.com. If you’ve never used JSFiddle this is a good opportunity to take a look!
You can try out the code on JSFiddle: http://jsfiddle.net/AFpYL/3/